package xyz.xmh.pattern.behavioral.commandpattern;

/**
 * @author Administrator
 * 命令模式演示类
 */
public class CommandPatternDemo {

    public static void main(String[] args) {
        // 实体对象
        Stock stock = new Stock();

        // 命令对象
        BuyStock buyStock = new BuyStock(stock);
        SellStock sellStock = new SellStock(stock);

        // 命令调用类
        Broker broker = new Broker();

        // 填充命令
        broker.takeOrder(buyStock);
        broker.takeOrder(sellStock);

        // 执行命令
        broker.placeOrders();

    }
}
